package 基础;

import java.io.IOException;
import java.net.SocketException;
import java.util.HashMap;
//服务器实现翻译功能
public class DemoServer_1 extends UdpEchServer{

    private HashMap<String,String> hashMap = new HashMap<>();
    public DemoServer_1(int port) throws SocketException {
        super(port);

        hashMap.put("小猫","cat");
        hashMap.put("小狗","dog");
        hashMap.put("人","people");
    }

    @Override
    public String process(String request) {
        return hashMap.getOrDefault(request,"你输入的词，我不会");
    }

    public static void main(String[] args) throws IOException {
        DemoServer_1 server1 = new DemoServer_1(9090);
        server1.start();
    }
}
